<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Horizon;
class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
		    \App\Models\User::observe(\App\Observers\UserObserver::class);
		    \App\Models\Collect::observe(\App\Observers\CollectObserver::class);
		    \App\Models\Tag::observe(\App\Observers\TagObserver::class);
		    \App\Models\Pictuer::observe(\App\Observers\PictuerObserver::class);
        \App\Models\CrawlerUrl::observe(\App\Observers\CrawlerUrlObserver::class);
        \App\Models\CrawlerPictuer::observe(\App\Observers\CrawlerPictuerObserver::class);
        \App\Models\ColorAverage::observe(\App\Observers\ColorAverageObserver::class);

        \Carbon\Carbon::setLocale('zh');
        // 配置 horizon 的访问权限
        Horizon::auth(function ($request) {
            $user = $request->user();
            return $user->email === 'fengzi91@vip.qq.com';
        });
    }
}
